package edu.nctu.csie.jichang.tw2cn;

import java.util.List;

import edu.nctu.csie.jichang.tw2cn.semantic.Semantic;
import edu.nctu.csie.jichang.tw2cn.tokenization.Tokenization;
import edu.nctu.csie.jichang.tw2cn.translation.JChineseConvertor;

public class Translate {

	public static String doTranslate(final String pContent) {
		return doTranslate(pContent,true,true);
	}
	
	public static String doTranslate(final String pContent,boolean pToken,boolean pSemantic) {
		String tTempStr = new String(pContent);
		List<String> tTokenList = null;
		if(pToken){
			System.setProperty("mmseg.dic.path", "tokenization");
			tTokenList = new Tokenization().doExecute(pContent);
			if(pSemantic){
				for (String s : tTokenList) {
					tTempStr = Semantic.getInstance().doExecute(tTempStr,s);
				}
			}
		}
		if(pSemantic){
			tTempStr = Semantic.getInstance().doExecute(tTempStr);
		}
		return JChineseConvertor.getInstance().t2s(tTempStr);
	}
}